<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of pagination
 *
 * @author ptnhuan
 */
class pagination {
    //put your code here
    public function display($total, $page) {
        $pages = $total / PER_PAGE;
        $html = "";
        $count = 1;
        $html.=" <a href='#'>$page</a> ";
        while ($count < PER_PAGE / 2) {
            if ($page + $count < $pages) {

                //for ($i = 1; $i < $pages; $i++) {
                $li = $page + $count;
                $html .= ' ' ."<a href='index.php?page=$li'>$li</a>";
            }
            if ($page - $count > 0) {
                $li = $page - $count;
                $html = ' '."<a href='index.php?page=$li'>$li</a>".$html;
            }
            $count++;
    }
        return $html;
    }
}

?>
